#include "queue.h"
#include <cstdio>
#include <cstdlib>
#include <iostream>

using namespace std;

int main() {
    Queue q;

    for (int i = 0; i < 20; ++i) {
        q.push_back(i + i);   
    }

    while (!q.empty()) {
        if (rand() % 10 > 6) {
            q.push_back(rand() % 10);
        } else {
            printf("%d\n", q.top());
            q.pop_front();
        }
    }
    return 0;
}